download file using jquery php

33

header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.$_REQUEST['f']);
readfile('../some_folder/some_subfolder/'.$_REQUEST['f']); 
exit;

//You open this php-file via 
window.location.href = 'scripts/this_php_file.php?f=downloaded_file';

Comments

Submit
0 Comments